#!/usr/bin/python
# -*- coding:utf-8 -*-
# @author  : micah
# @time    :  
# @function: 
# @version :


from threading import Thread, Lock, RLock

num = 0
# lock_obj = Lock()
lock_obj = RLock()


def add_num():
    global num
    for i in range(100000):
        lock_obj.acquire()
        lock_obj.acquire()
        num += 1
        lock_obj.release()
        lock_obj.release()
    print(num)


for _ in range(2):
    t = Thread(target=add_num)
    t.start()
